# -*- coding: utf-8 -*-
# @Time: 2021/8/5 9:01
# @File: problem-7.py
# @DESC: https://leetcode-cn.com/problems/reverse-integer/
class Solution:
    def reverse(self, x: int) -> int:
        if x > 0:
            result = int(str(x)[::-1])
        else:
            result = 0 - int(str(-x)[::-1])

        print(bin(result))
        print(int(-0b100000000000000000000000000000000))
        if result < int(-0b10000000000000000000000000000000) or \
                result > int(0b1111111111111111111111111111111):
            result = 0
        return result


s = Solution()
a = -1563847412
r = s.reverse(a)
print(r)

